#include "name_pipe.hpp"

int main()
{
    std::cout << "cilent begin" << std::endl;
    int wrid = open(NAME_PIPE, O_WRONLY);
    assert(wrid >= 0);
    char buffer[1024] = {0};
    while (1)
    {
        std::cout << "Please say# : ";
        fgets(buffer, sizeof(buffer), stdin);
        if (strlen(buffer) > 0)
            buffer[strlen(buffer) - 1] = '\0';
        ssize_t ret = write(wrid, buffer, sizeof(buffer));
        assert(ret >= 0);
        (void)ret;
    }
    close(wrid);
    std::cout << "cilent end" << std::endl;

    return 0;
}